package com.etcsoft.pagedesigner;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

/**
 * @author korman21@gmail.com
 *
 */
public class PageDesignerPlugin extends AbstractUIPlugin {

    public static final String ID = "com.etcsoft.pagedesigner"; //$NON-NLS-1$

    private static PageDesignerPlugin plugin;

    public PageDesignerPlugin() {
    }

    /*
     * (non-Javadoc)
     * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
     */
    @Override
    public void start(BundleContext context) throws Exception {
        super.start(context);
        plugin = this;
    }

    /*
     * (non-Javadoc)
     * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
     */
    @Override
    public void stop(BundleContext context) throws Exception {
        plugin = null;
        super.stop(context);
    }

    /**
     * @return
     */
    public static PageDesignerPlugin getDefault() {
        return plugin;
    }

    /**
     * @param path
     * @return
     */
    public static ImageDescriptor getImageDescriptor(String path) {
        return imageDescriptorFromPlugin(ID, path);
    }
}
